<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ProfilePage
 *
 * @author juwking
 */
require_once './controllers/PageController.php';

class ProfilePage extends PageController {

    private $content = "profile/profile.tpl";

    function __construct() {
        parent::__construct();
    }

    function getPageName() {
        return 'profile';
    }


    public function getTemplate() {
        return $this->content;
    }

    public function getSidebar() {
        $sidebar = array(
            array(label => 'Dane osobiste', link => 'personalData'),
            array(label => 'Pamięć skryptu', link => 'scriptMemoryUsage'),
            array(label => 'Wyloguj', link => 'logout')
        );
        return $sidebar;
    }
    public function getUserCredits(){
        
        return $_SESSION['UserAccess'];
    }
    public function personalData() {
        
        $this->smarty->display("profile/userdata.tpl");
    }

    public function scriptMemoryUsage() {
        $this->assign('memory', $this->convert(memory_get_usage()));
        $this->smarty->display("profile/scriptusage.tpl");
        
    }

    function convert($size) {
        $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
        return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i];
    }
    function logout() {
        include 'logout.php';
    }

}

?>
